//
//  WXLPlayMusicViewController.m
//  
//
//  Created by dllo on 16/3/21.
//
//

#import "WXLPlayMusicViewController.h"

@interface WXLPlayMusicViewController ()<PlayMusicViewDelegate>

@property (nonatomic, retain) PlayMusicView *playMusicView;


@end

@implementation WXLPlayMusicViewController

+ (WXLPlayMusicViewController *)shareWXLPlayMusicViewController {
    
    static WXLPlayMusicViewController *myPMVC = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        
        myPMVC = [[WXLPlayMusicViewController alloc] init];
       
    });
    return myPMVC;
}


- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        [self createSubView];
        
        
    }
    return self;
}


- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.navigationController.navigationBar.hidden = YES;
    
}

- (void)createSubView {
    self.playMusicView = [PlayMusicView plyMusicView];
    
    [self.view addSubview:_playMusicView];
    
    _playMusicView.delegate = self;
}




#pragma mark - PlayMusicViewDelegate
// 返回
- (void)buttonToClick {
    [self dismissViewControllerAnimated:YES completion:nil];
}

// 播放 暂停
- (UIImage *)playButtonClick:(BOOL)isPlay {
    if (isPlay) {
        [PLAYMUSIC pausePlay];
        return [UIImage imageNamed:@"iconfont-bofang-2"];
    } else {
        [PLAYMUSIC startPlay];
        return [UIImage imageNamed:@"iconfont-suopingzanting-3"];
    }
}



- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    
    [_playMusicView animation];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)viewDidDisappear:(BOOL)animated {
    [super viewDidDisappear:animated];
    
    self.navigationController.navigationBar.translucent = NO;
    self.navigationController.navigationBar.hidden = NO;
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
